<?php
header("Content-type: text/html; charset=utf-8");
ini_set('display_errors',1);
set_time_limit(0); 
include_once dirname(dirname(dirname(__FILE__))) . '/mgtv_init.php';
include_once dirname(dirname(__FILE__)) . '/init.php';
$db = nn_get_db(NL_DB_WRITE);
$bool =  true;
$i = 0;
while($bool){	
	$sql = "select * from nns_vod_index where nns_deleted!=1 limit $i ,1";	
	$vod_index_info = nl_db_get_one($sql, $db);	
	if(is_array($vod_index_info)&&!empty($vod_index_info)){		
		//查询这个分集有没有切片任务
		$sql_clip = "select * from nns_mgtvbk_clip_task where nns_org_id='fjyd' and nns_video_id='{$vod_index_info['nns_vod_id']}'  and nns_video_index_id='{$vod_index_info['nns_id']}'";		
		$clip_info = nl_db_get_one($sql_clip, $db);
		if(is_array($clip_info)&&!empty($clip_info)){
			if($clip_info['nns_state']!='c2_ok'){
				//nl_execute_by_db("update nns_mgtvbk_clip_task set nns_state=null where nns_id='{$clip_info['nns_id']}'", $db);
			}
		}else{
			$task_info = array();
			$task_info['nns_video_type'] = 0;
			$task_info['nns_video_id'] = $vod_index_info['nns_vod_id'];
			$task_info['nns_video_index_id'] = $vod_index_info['nns_id'];
			$task_info['nns_index'] = $vod_index_info['nns_index'];
			$task_info['nns_org_id']= 'fjyd';
			//clip_task_model::add_task($task_info);
			echo "添加切片------".$vod_index_info['nns_name'].PHP_EOL;
		}
	}else{
		$bool = false;
	}
	
	$i++;
	
	if($i==5){
		$bool = false;
	}
	
	
		
}
